/******************************************************************************
   Copyright (c) 2006 by RockOS.
   All rights reserved.

   This software is supported by Rock Software Workroom.

   Any bugs please contact the author with e-mail or QQ:
     E-mail : baobaoba520@yahoo.com.cn
         QQ : 59681888
*******************************************************************************
File name   : main.c
Description : This is the C entry for ARM board.
            : 
Auther      : sunxinqiu
History     :
  2006-3-15   first release.
******************************************************************************/

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "..\inc\typedef.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\music.h"

extern MUSIC_NOTE defaultMusic[];

/******************************************************************************
Function    : void Main()
Params      : N/A
            : 
            : 
            : 
Return      : never return.
Description : this is the main entry of the C code, all hardware devices should
            : should be initialized before starting the OS.
******************************************************************************/
void Main ()
{
    int i;
    /* Init GPIO. */
    init_gpio();

    /* interrupt controller. */
    init_irq();

    /* PWM Timer. */
    init_pwm();

    /* start pwm timer5. */
    pwm_start(PWM_TIMER5, 10000/TICK_INT_FREQ, 1);

    /* UART. */
    init_uart();

    /* display the copyright informations. */
    UART_sendString(UART_CH0, "\n");
    
    for (i = 0; i < 2; ++ i)
    {
        play_music(&defaultMusic[0]);
    }
    
    for (;;);
}
